@extends('admin.adminbase')
@section('content')
    <section class="hbox stretch">
        @include("admin.public.left")
        <aside>
            <section class="vbox">
                <header class="header bg-white b-b clearfix">
                    <form class="talbe-search" method="get" action="{{url('admin/verify/search')}}">
                        <div class="row m-t-sm">
                            <div class="col-sm-5 m-b-xs">
                            </div>
                            <div class="col-sm-7 m-b-xs">
                                <div class="input-group">
                                    <input class="input-sm" name="keyword" value="{{ old('keyword') }}" placeholder="请输入景区名" type="text">&nbsp
                                    <input type="text" name="start_time" value="{{ old('start_time') }}" id="start" placeholder="开始时间">&nbsp—&nbsp
                                    <input type="text" name="end_time" value="{{ old('end_time') }}" id="end" placeholder="结束时间">&nbsp
                                    <button class="btn btn-sm btn-default" type="submit" title="搜索" style="margin-top: -5px">
                                        <i class="glyphicon glyphicon-search"></i> 搜索
                                    </button>
                                </div>
                            </div>
                        </div>
                    </form>
                </header>
                <section class="scrollable  wrapper w-f">
                    <section class="panel panel-default">
                        <div class="table-responsive">
                            <table class="table table-hover m-b-none entity-view" data-path="/attendance/count/countDetail/id/{0}">
                                <thead>
                                <tr>
                                    <th style="text-align: center;">序号</th>
                                    <th style="text-align: center;">景区名</th>
                                    <th style="text-align: center;">所在省/市</th>
                                    <th style="text-align: center;">卡号</th>
                                    <th style="text-align: center;">核销日期</th>
                                    <th style="text-align: center;">人次数</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach ($res as $k=>$v)
                                    <tr>
                                        <td style="text-align: center;">{{$limit*($res->currentPage()-1)+$k+1}}</td>
                                        <td style="text-align: center;">{{$v->name}}</td>
                                        <td style="text-align: center;">{{$v->dname}}</td>
                                        <td style="text-align: center;">{{$v->card_num}}</td>
                                        <td style="text-align: center;">{{\App\Http\Util\TimeHelper::formatDate($v->updated_at)}}</td>
                                        <td style="text-align: center;">{{$v->number}}</td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                        </div>
                    </section>
                    <div style="text-align: center">{!! $res->appends($_GET)->render() !!}</div>
                </section>

            </section>
        </aside>
    </section>

@endsection

@section('addscript')
    <script src="{{ url('/') }}/laydate/laydate.js"></script>
    <script>
        var start = {
            elem: '#start',
            format: 'YYYY-MM-DD',
            max: '2099-06-16', //最大日期
            istime: false,
            istoday: true,
            choose: function(datas){
                end.min = datas; //开始日选好后，重置结束日的最小日期
                end.start = datas //将结束日的初始值设定为开始日
            }
        };
        var end = {
            elem: '#end',
            format: 'YYYY-MM-DD',
            max: '2099-06-16',
            istime: false,
            istoday: true,
            choose: function(datas){
                start.max = datas; //结束日选好后，重置开始日的最大日期
            }
        };
        laydate(start);
        laydate(end);

        $(function(){
            $(".del").click(function(){
                var url=$(this).attr("data-back");

                layer.confirm('您确定删除吗？', {
                    btn: ['确认','取消'] //按钮
                }, function(){
                    $.ajax({
                        'url':url,
                        'type':"get",
                        'dataType':'json',
                        'success':function(data){
                            if(data.success){
                                layer.alert("删除成功！",function(){
                                    location.reload();
                                });
                            }else{
                                layer.alert(data.msg)
                            }
                        }
                    })
                }, function(){

                })
            })
        });
    </script>
@endsection
